<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Las frases míticas de CITIC</title>
  
  <!-- CSS Styles --> 
  <link type="text/css" rel="stylesheet" href="/static/css/styles.css"/>
  
  <!-- Scripts -->
  <script type="text/javascript" src="/static/js/jquery-1.3.2.js"/></script>
  <script type="text/javascript" src="/static/js/ajax.js"/></script>
  
  <script type="text/javascript">
  
  	$(document).ready(function(){
  	
  		// Check every x seconds latest phrases
  		setInterval("getLastPhrase();",30000);
  	
  	});
  
  </script>
 
  <script language='javascript'>
   function verifyMe(){
        var msg='';

	if(document.getElementById('phrase').value==''){
		msg+='- Frase mítica:\n\n';}

	if(msg!=''){
		alert('Los siguiente campos estan vacios o son invalidos:\n\n'+msg);
		return false
	}else{
		return true }

	}
  </script>
</head>
<body>
<div class='container'><div class='divspacing'></div>
 <h2 align='center' class='subtitle'><em>All your phrases are belong to us</em></h2>
 <p class='rsslink'><a href="/miticas/rss/">Feed RSS</a></p>
 {% for phrase in phrases %}
  <div class='post'>
   <h2><a id="{{ phrase.id }}" href={{ '/miticas/phrase/' ~ phrase.id }} class='phraselink'>Frase m&iacute;tica n&uacute;mero {{ phrase.id }}:</a></h2>
   <p class='phrase'>&quot;{{ phrase.phrase }}&quot;</p>
   <p class='date'>{{ phrase.date }} - <a href={{ '/miticas/phrase/' ~ phrase.id }}>{{ commentdict[phrase.id] }} comentarios</a></p>
  </div>
 {% endfor %}
 {% if pages %}
	 <div class='divpagination'>
	 <ul id='pagination'>
	 {% if actual in [0, 1] %}
		<li class='active'>{{ actual }}</li>
		{% for num in range(2, trail + 1) %}
			<li><a href={{ "/miticas/page/" ~ num }}>{{ num }}</a></li>
		{% endfor %}
		<li class='next'><a href={{ "/miticas/page/" ~ (actual + 1) }}>&raquo;</a></li>
	 {% elif actual in [2, 3, 4] %}
		<li class='previous'><a href={{ "/miticas/page/" ~ (actual - 1) }}>&laquo;</a></li>
		{% for num in range(1, actual) %}
			<li><a href={{ "/miticas/page/" ~ num }}>{{ num }}</a></li>
		{% endfor %}
		<li class='active'>{{ actual }}</li>
		{% for num in range(actual + 1, trail + 1) %}
			<li><a href={{ "/miticas/page/" ~ num }}>{{ num }}</a></li>
		{% endfor %}
		{% if not_last %}
			<li class='next'><a href={{ "/miticas/page/" ~ (actual + 1) }}>&raquo;</a></li>
		{% endif %}
         {% else %}
		<li class='previous'><a href={{ "/miticas/page/" ~ (actual - 1) }}>&laquo;</a></li>
		{% for num in range(actual - 2, actual) %}
			<li><a href={{ "/miticas/page/" ~ num }}>{{ num }}</a></li>
		{% endfor %}
		<li class='active'>{{ actual }}</li>
		{% for num in range(actual + 1, trail + 1) %}
			<li><a href={{ "/miticas/page/" ~ num }}>{{ num }}</a></li>
		{% endfor %}
		{% if not_last %}
			<li class='next'><a href={{ "/miticas/page/" ~ (actual + 1) }}>&raquo;</a></li>
		{% endif %}
	 {% endif %}
	 </ul>
         </div>
 {% endif %}
 
 <div class='inputbox'>
  <h2>Inserta aqui una frase m&iacute;tica</h2>
	<form name='formulario_envio' action='/miticas/new_phrase/' method='POST' enctype='application/x-www-form-urlencoded' onsubmit='return verifyMe();'>
	<table cellspacing='0'>
		<tr>	<td></td>
			<td><p><em>Puedes usar bbcode para realzar las frases...</em></p></td>
		</tr>
		<tr>
			<td valign='top'><LABEL for='phrase' ACCESSKEY='none' ><b style='color:red'>*</b>Frase m&iacute;tica:
			</td>
			<td><textarea name='phrase' cols='42' rows='6' value=''></textarea>
			</td>
		</tr>
		<tr>
			<td colspan='2' align='right'><input type='submit' name='submit' value='Enviar'>&nbsp;<input type='reset' name='reset' value='Limpiar'><br /><a href='http://www.formgenics.com' style='font-family:arial;font-size:10px;color:#C0C0C0;text-decoration:none'>powered by FormGenics.com</a>
			</td>
		</tr>
	</table>
	</form>
  </div>
</div>
</body>
</html>
